package common

type Resp struct {
	Code int         `json:"code"`
	Data interface{} `json:"data"`
	Msg  string      `json:"msg"`
}

func OK(data interface{}) Resp {
	resp := &Resp{}
	resp.Code = 0
	resp.Data = data
	resp.Msg = "success"
	return *resp
}

func Error(errCode int, errMsg string) Resp {
	resp := &Resp{}
	resp.Code = errCode
	resp.Msg = errMsg
	return *resp
}
